<h2><%= t(".title") %></h2>

<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: {method: :put}) do |f| %>
  <div class="row mb-4">
    <div class="col-12 col-sm">
      <%- if SiteSettings.multiuser_enabled? %>
        <div class="card mb-2">
          <h4 class="card-header"><%= t(".contact_info") %></h4>
          <div class="card-body tabular-form">
            <%= text_input_row f, :email, autocomplete: "email",
                  help: (devise_mapping.confirmable? && resource.pending_reconfirmation?) ?
                    t(".currently_waiting_confirmation_for_email", email: resource.unconfirmed_email) :
                    nil %>
            <%= text_input_row f, :username, autocomplete: false %>
            <% if SiteSettings.federation_enabled? %>
              <div class="col-auto col-form-label"><%= t("settings.users.index.fediverse_address") %></div>
              <div class="col col-form-label">
                <%= CopyableText(text: resource.federails_actor.at_address, label: t("general.copy_fediverse_handle")) %>
              </div>
            <% end %>
          </div>
        </div>
        <div class="card mb-2">
          <h4 class="card-header"><%= t(".security") %></h4>
          <div class="card-body tabular-form">
            <%= password_input_row f, :password, autocomplete: "new-password", strength_meter: true %>
            <%= password_input_row f, :password_confirmation, autocomplete: "new-password" %>
            <%= password_input_row f, :current_password, autocomplete: "current-password",
                  help: t(".current_password_help") %>
          </div>
        </div>
      <% end %>
      <%= render "general_settings", form: f %>
      <%= render "tag_cloud_settings", form: f %>
      <%= render "pagination_settings", form: f %>
      <%= render "file_list_settings", form: f %>
    </div>
    <div class="col-12 col-sm">
      <%- if SiteSettings.multiuser_enabled? %>
        <%- if @user.has_quota? %>
        <div class="card mb-2">
          <h3 class="card-header"><%= t("settings.users.quota.title") %></h3>
          <div class="card-body">
            <div class="row text-center">
              <div class="col">
                <%= DisplayUserQuota(current_size: @user.current_space_used, quota: @user.quota) %>
              </div>
            </div>
          </div>
        </div>
        <% end %>
      <% end %>
      <%= render "renderer_settings", form: f %>
      <%= render "problem_settings", form: f %>
      <%- if SiteSettings.multiuser_enabled? %>
        <div class="card border-danger mt-3">
          <h4 class="card-header text-bg-danger"><%= t ".danger_zone" %></h4>
          <div class="card-body">
            <p class="card-text">
              <%= link_to t(".cancel_my_account"),
                    registration_path(resource_name),
                    data: {confirm: translate(".confirm_deletion"), turbo_confirm: translate(".confirm_deletion")},
                    method: :delete,
                    class: "btn btn-danger" %>
            </p>
          </div>
        </div>
      <% end %>
    </div>
  </div>

  <div class="row mb-4">
    <div class='col'>
      <button type="submit" class="btn btn-primary"><%= Icon(icon: "save", label: t(".submit")) %> <%= t(".submit") %></button>
    </div>
  </div>

<% end %>
